﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Game.templates.item
{
    public class ItemFlags
    {
        private int _mask;
        private string _name;
        private static int _num=0;
	    /**
	     * Field _defaultValue.
	     */
	    private bool _defaultValue;
	
	    /**
	     * Constructor for ItemFlags.
	     * @param defaultValue boolean
	     */
	    ItemFlags(string name,int num,bool defaultValue)
	    {
	        _name = name;
		    _defaultValue = defaultValue;
		    _mask = 1 << num;
	    }
	
	    /**
	     * Method mask.
	     * @return int
	     */
	    public int mask()
	    {
		    return _mask;
	    }
        public override string ToString()
        {
            return _name;
        }
	    /**
	     * Method getDefaultValue.
	     * @return boolean
	     */
	    public bool getDefaultValue()
	    {
		    return _defaultValue;
	    }
        public static readonly ItemFlags DESTROYABLE = new ItemFlags("DESTROYABLE",_num++,true);
        public static readonly ItemFlags DROPABLE = new ItemFlags("DROPABLE", _num++, true);
        public static readonly ItemFlags FREIGHTABLE = new ItemFlags("FREIGHTABLE", _num++, false);
        public static readonly ItemFlags AUGMENTABLE = new ItemFlags("AUGMENTABLE", _num++, true);
        public static readonly ItemFlags ENCHANTABLE = new ItemFlags("ENCHANTABLE", _num++, true);
        public static readonly ItemFlags ATTRIBUTABLE = new ItemFlags("ATTRIBUTABLE", _num++, true);
        public static readonly ItemFlags SELLABLE = new ItemFlags("SELLABLE", _num++, true);
        public static readonly ItemFlags TRADEABLE = new ItemFlags("TRADEABLE", _num++, true);
        public static readonly ItemFlags STOREABLE = new ItemFlags("STOREABLE", _num++, true);
        public static IEnumerable<ItemFlags> Values
        {
            get
            {
                yield return DESTROYABLE;
                yield return DROPABLE;
                yield return FREIGHTABLE;
                yield return AUGMENTABLE;
                yield return ENCHANTABLE;
                yield return ATTRIBUTABLE;
                yield return SELLABLE;
                yield return TRADEABLE;
                yield return STOREABLE;
            }
        }
    }
}
